import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

/// 视频封面上的播放按钮 + 渐变遮罩层
class PlayOverlayButton extends StatelessWidget {
  final VoidCallback? onTap;

  const PlayOverlayButton({super.key, this.onTap});

  @override
  Widget build(BuildContext context) {
    return Positioned.fill(
      child: Stack(
        alignment: Alignment.center,
        children: [
          // 渐变遮罩层
          DecoratedBox(
            decoration: BoxDecoration(
              gradient: LinearGradient(
                begin: Alignment.topCenter,
                end: Alignment.bottomCenter,
                colors: [
                  Colors.black.withOpacity(0.1),
                  Colors.black.withOpacity(0.25),
                ],
              ),
            ),
          ),
          // 播放按钮（可点击）
          GestureDetector(
            onTap: onTap,
            behavior: HitTestBehavior.translucent,
            child: Container(
              width: 48.r,
              height: 48.r,
              decoration: BoxDecoration(
                color: Colors.black.withOpacity(0.4),
                shape: BoxShape.circle,
              ),
              child: Icon(
                Icons.play_arrow_rounded,
                color: Colors.white,
                size: 32.r,
              ),
            ),
          ),
        ],
      ),
    );
  }
}
